package day1110_3;

import java.io.File;
import java.io.IOException;

public class W3 {
    public static void main(String[] args) throws IOException {
//        File  obj=new File("D:\\obj.txt");
//        System.out.println( obj.length() );//obj.txt字节数
//        System.out.println( obj.lastModified() );//obj.txt字节数
//        System.out.println(obj.getName());
//        System.out.println(obj.getParent());
//        System.out.println(obj.getPath());
        File  obj=new File("D:\\obj.txt");
        if(obj.exists()) System.out.println("文件存在");
        System.out.println(obj.isFile());//true
        System.out.println(obj.isDirectory());//false
        System.out.println(obj.canRead());//true
        obj.renameTo( new File("D:\\obj2.txt") );


        File   b2=new File("D:\\b2.txt");
        if( !b2.exists() ){
            b2.createNewFile();
        }

        boolean isDel=b2.delete();//true
    }
}





